<template>
  <a-modal :open="open" width="1180px" title="明细" centered :keyboard="false" :footer="null" @cancel="onCancel">
    <div class="flex mb-4">
      <LabelValue label="接诊日期" :value="rowData.ghsj" :width="200" label-class="w-[120px] text-right" />
      <LabelValue label="诊断名称" :value="rowData.bcLczdZdmc" :width="300" label-class="w-[120px] text-right" />
      <LabelValue label="确认次数" :value="rowData.qzcs" :width="200" label-class="w-[120px] text-right" />
    </div>
    <BaseTable
      :loading="loading"
      bordered
      column-code="000497"
      :data-source="tableData"
      :pagination="pagination"
      :scroll="{ x: 1500 }"
      :extra-height="50"
      max-fill
    >
      <template #bodyCell="{ column, index }">
        <template v-if="column.dataIndex === 'xh'">
          {{ index + 1 }}
        </template>
      </template>
    </BaseTable>
  </a-modal>
</template>

<script setup>
const props = defineProps({
  open: {
    type: Boolean,
    default: false
  },
  rowData: {
    type: Object,
    default: () => ({})
  }
})

const emit = defineEmits(['update:open', 'success'])
const { loading, tableData, getData, pagination } = useTable({
  url: '/statistic/getDiseaseDetailStatistics',
  immediate: false,
  formatParams: () => {
    return {
      bcLczdZddm: props.rowData.bcLczdZddm,
      endDate: props.rowData.endDate,
      startDate: props.rowData.startDate
    }
  }
})
const onCancel = () => {
  emit('update:open', false)
}
watch(
  () => props.open,
  (val) => {
    if (val) {
      getData()
    }
  }
)
</script>
<style lang="less" scoped></style>
